Image processing apparatus and method for attribute data encoding

ABSTRACT

M×N attribute data for M×N pixels, where M and N are integer multiple of “L” are input. Data expressed by L bits are encoded, A first encoding control step supplies the M×N attribute data to be encoded in an input order, causing encoding to be executed. A second encoding control step converts the M×N attribute data input into bit planes of bit  0  to bit L−1, extracts L-bit data from one converted bit plane, and supplies the extracted L-bit data for each bit plane, causing encoding to be executed. An amount of encoded data generated by the encoding under the control of the first encoding control step is compared with an amount of encoded data generated in the encoding under the control of the second encoding control step, and encoded data with a smaller amount are selected. The selected encoded data and identification information representing the selected data are then output.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a technique of encoding the attributedata of image data.

2. Description of the Related Art

Image data is sometimes processed using area information (attributedata) associated with the image data. Area information is mainly usedfor a color process or tone count adjustment in an image output unit toenhance the appearance of an output image. When black is reproduced bymixing yellow, magenta, and cyan in an achromatic color area of anatural image, it can maintain a suitable appearance. When blackcharacters or line images that frequently appear in a document areprinted monochromatically using only black, the characters/line imagescan have sharp edges.

If each pixel has 1-bit attribute data indicating chromaticcolor/achromatic color or character/non-character, the quality of anoutput image can be improved at the time of output and, in particular,printing. Information except those described above can also be added asarea information.

To compress image information, not only image data but also areainformation needs to be compressed. Area information is a set of binarydata. To compress it, basically, a lossless encoding method must beused. Conventionally, Packbits and JBIG encoding are used to compressarea information (e.g., Japanese Patent Laid-Open No. 2003-69835).

However, it is impossible to adjust the code amount of attribute data bycompressing it using an encoding method according to the technique inthe above reference. Use in a system with a limit memory capacity maycause overflow which poses a serious problem.

SUMMARY OF THE INVENTION

The present invention has been made in consideration of theabove-described problem, and has as its object to provide a techniquecapable of increasing a compression ratio in encoding attribute dataexpressed by a plurality of bits by using a normal lossless encodingmethod.

In order to achieve this object, an image processing apparatus of thepresent invention has the following arrangement. That is, there isprovided an image processing apparatus for encoding attribute data ofeach pixel of image data, which is expressed by L (L>1) bits to indicateON or OFF state for each of a plurality of attributes, comprising:

an input unit adapted to input M preset attribute data;

an encoding unit adapted to encode data expressed by L bits;

a first encoding control unit adapted to supply the M attribute datainput to the input unit to the encoding unit in an input order, therebycausing the encoding unit to execute encoding;

a second encoding control unit adapted to convert the M attribute datainput to the input unit into bit planes of bit 0 to bit L−1, extractL-bit data from one converted bit plane, and supply the extracted L-bitdata to the encoding unit for each bit plane, thereby causing theencoding unit to execute encoding; and

an output control unit adapted to compare an amount of encoded datagenerated by the encoding unit under the control of the first encodingcontrol unit with an amount of encoded data generated by the encodingunit under the control of the second encoding control unit, selectencoded data with a smaller amount, and output the selected encoded dataand identification information representing the selected data.

According to the present invention, it is possible to encode attributedata expressed by a plurality of bits at a high compression ratio usinga normal lossless encoding technique.

Further features of the present invention will become apparent from thefollowing description of exemplary embodiments with reference to theattached drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings, which are incorporated in and constitute apart of the specification, illustrate embodiments of the invention and,together with the description, serve to explain the principles of theinvention.

FIG. 1 is a block diagram of an image processing unit according to anembodiment;

FIG. 2 is a block diagram of a printer apparatus according to theembodiment;

FIG. 3 is a flowchart illustrating a process procedure of encoding animage and attribute flag data according to the embodiment;

FIG. 4 is a view showing the sequence of an image encoding unit andimage decoding unit according to the embodiment;

FIG. 5 is a block diagram of an attribute flag encoding unit accordingto the embodiment;

FIG. 6 is a flowchart illustrating the encoding procedure of theattribute flag encoding unit according to the embodiment;

FIG. 7 is a view showing the data format of an attribute flag accordingto the embodiment;

FIG. 8 is a view for explaining the contents of the attribute flag dataprocess in the first phase according to the embodiment;

FIG. 9 is a view for explaining the contents of the attribute flag dataprocess in the second phase according to the embodiment; and

FIG. 10 is a view for explaining the process contents of an attributeflag decoding unit according to the embodiment.

DESCRIPTION OF THE EMBODIMENTS

An embodiment of the present invention will be described below in detailwith reference to the accompanying drawings.

First Embodiment

FIG. 2 is a block diagram showing the schematic arrangement of aprinting system according to the embodiment. A printer apparatus 10receives a print job from a host computer 50 and forms a visible imageon a printing medium such as a printing paper sheet on the basis of theprint job.

A control unit 1011 analyzes the print job received from the hostcomputer 50 and generates image data in a format providable to a printerengine 1014. A CPU 1012 implements various kinds of control in theprinter apparatus 10 by executing programs stored in a memory 1013. Theprinter engine 1014 forms a visible image on a printing paper sheet inaccordance with image data received from the control unit 1011. Variouskinds of printer engines using, e.g., an electrophotographic scheme,inkjet scheme, or thermal printing scheme are applicable to the printerengine 1014. Reference numeral 105 denotes a hard disk.

An operable printer driver (not shown) corresponding to the printerapparatus 10 is installed in the host computer 50. For example, when anapplication issues a created document print instruction, the printerdriver generates a print job in a page description language (PDL)analyzable by the printer apparatus 10 and transmits it to the printerapparatus 10.

FIG. 1 is a block diagram mainly showing the functional blocks of animage processing unit in the printer apparatus 10 according to theembodiment. This image processing unit is implemented usingpredetermined hardware resources (e.g., line buffers) when the CPU 1012executes a control program (firmware) stored in the memory 1013.

The image processing unit includes a rendering unit 100, buffer memories101, 104 106, and 109, attribute flag encoding unit 102, image encodingunit 103, image decoding unit 107, and attribute flag decoding unit 126.

The operation of the printer apparatus 10 according to the embodimentwith the above-described arrangement will be described with reference tothe flowchart in FIG. 3.

Upon receiving a print job from the host computer 50, the rendering unit100 analyzes the PDL. PDL data includes a line image rendering command,a character rendering command containing a typeface (font name), size,and character code, and bitmap data such as a natural image. Therendering unit 100 analyzes the commands and executes rendering in arendering area ensured in the memory 1013. The rendering process revealsthe attributes of individual pixels. The attributes are written in anattribute flag area allocated in the memory 1013 as attribute flags (inthis embodiment, attribute data is expressed by 1 byte whose bits areassigned eight ON/OFF identification data including chromaticcolor/achromatic color, character/non-character (natural image),halftone dot/non-halftone dot, line image/non-line image,presence/absence of objects, scanner input/PDL input, andgraphic/non-graphic) (steps S11, S12, and S13).

The rendering unit 100 stores the rendered bitmap image in the buffermemory 101 via a signal line 1001 and the attribute flag data in thebuffer memory 101 via a signal line 1002. The image encoding unit 103compression-codes the rendered bitmap image data by a lossy compressioncoding method (JPEG method in this embodiment) (step S14). On the otherhand, the attribute flag encoding unit 102 lossless-compression-codesthe attribute flag data (step S15). The encoded image data and attributeflag data are temporarily stored in the buffer memory 104, associatedwith each other, and stored in the HDD 105 as files.

In the above-described way, image data and attribute flag data areencoded for each page and stored in the HDD 105.

The image decoding unit 107 and attribute flag decoding unit 126 monitorthe presence/absence of encoded image data files and encoded attributeflag data files in the HDD 105. Upon determining that an unprinted datafile exists, the decoding units read out the compressed data files fromthe HDD 105 and decode them in accordance with the print speed of theprinter engine 1014. Image data obtained by decoding is subjected tovarious kinds of image processing corresponding to the decoded attributeflag data and output to the printer engine 1014.

That is, image data and attribute flag data are encoded independently(asynchronously) of the print speed of the printer engine 1014. Thisquickly releases the host computer from the print data output process.

The embodiment has its characteristic feature in compression coding ofan image and attribute flag data. The compression process will bedescribed below in more detail.

Image data and attribute flag data generated by the rendering unit 100are stored in the buffer memory 101. The image encoding unit 103receives each tile of M×N pixels from the buffer memory 101 and encodesthe received tile of color image data by discrete cosine transformationencoding (JPEG). The attribute flag encoding unit 102 alsorun-length-encodes attribute flag data corresponding to M×N pixels. Mand N need to be multiples of a window size for discrete cosinetransformation encoding. In this embodiment, image data is encoded byemploying a JPEG compression method, the minimum encoding window size is8×8 pixels. The size of one tile is set to an integer multiple of thewindow size, e.g., M=N=32 (8×4). A tile with 32×32 pixels contains 4×4(16) pixel windows each having 8×8 pixels. Hence, to encode one tile,JPEG compression of an 8×8 pixel window is executed 16 times. Thefollowing explanation will be done assuming M=N=32. However, the valueis not limited to this.

The image encoding unit 103 quantizes 16 8×8 pixel windows contained ina tile image with 32×32 pixels by known DCT. The image encoding unit 103then assigns Huffman code words to the quantized data to generate codewords.

The attribute flag encoding unit 102 also run-length-encodes each tilecontaining 32×32 pixels and outputs code words.

The encoded data thus output from the image encoding unit 103 is storedin the buffer memory 104. The attribute flag encoding unit 102 outputsthe encoded data of the attribute flag data to the buffer memory 104.When the buffer memory 104 stores the encoded data of image data andattribute flag data corresponding to one tile, they are stored asadditional data in the corresponding files ensured in the HDD 105.

As described above, the rendered bitmap image is JPEG-compressed andsaved. It is therefore easy to handle the data.

The arrangements and operations of the image encoding unit 103 and imagedecoding unit 107 will be described in detail with reference to FIG. 4.The arrangement and operation of the attribute flag encoding unit 102will be described in detail with reference to FIG. 5.

FIG. 4 is a view showing the flow of data in the image encoding unit 103and image decoding unit 107. In FIG. 4, units 11 to 14 correspond to thearrangement of the image encoding unit 103, and units 16 to 19correspond to the arrangement of the image decoding unit 107. A memory15 includes the buffer memories 104 and 106 and the HDD 105.

A bitmap image 200 rendered by the rendering unit 100 is supplied to thecolor conversion unit 11 of the image encoding unit 103 via the buffermemory 101. The bitmap image is supplied as an image signal. A colorsignal has, e.g., three color components of red (R), green (G), and blue(B) each expressed by 256 tones (8 bits).

The color conversion unit 11 converts the received R, G, and B signalsinto luminance and color difference signals (Y, Cb, and Cr). The DCTunit (discrete cosine transformation) 12 executes spatial frequencytransformation (DCT) for each 8×8 pixel block of each of the luminance Yand color difference signals Cb and Cr. The quantization unit 13quantizes the DCT coefficients to reduce the data amount. The VLC unit(variable-length coding unit) 14 Huffman-encodes the quantization valuesto further reduce the data amount.

The functional arrangement of the image encoding unit 103 has beendescribed above. The compressed image data is stored in the buffermemory 104 and HDD 105 in this order (memory 15 in FIG. 4).

The stored compressed image data is decoded in accordance with thefollowing procedure. First, the VLD unit (variable-length decoding unit)16 Huffman-decodes the compressed image data. The inverse quantizationunit 17 returns the data to DCT coefficient values by using a setinverse quantization matrix. The IDCT unit (inverse discrete cosinetransformation unit) 18 executes inverse discrete cosine transformationto return the DCT coefficients to the luminance and color differencesignals. The color conversion unit 19 converts the luminance Y and colordifference signals Cb and Cr into print color components of Y (yellow),M (magenta), C (cyan), and K (black). As a result of the above-describedcompression and decoding processes, the image decoding unit 107 outputsa color image signal 201.

FIG. 5 is a block diagram of the attribute flag encoding unit 102.

The attribute flag encoding unit 102 of this embodiment lossless-encodesattribute flag data (one attribute flag data=1 byte=8 bits) of one tile(32×32 pixels) twice. One of the two encoded data obtained by the twoencoding processes, which has a smaller data amount, is output as thefinal encoded data of attribute flag data.

A rearrangement unit 309 performs different operations in the first andsecond phases (to be described later in detail). As a common operationin the two phases, the rearrangement unit 309 reads out 32×32 flag datafrom the buffer memory 101 in the raster scan order and outputs them as1-byte (8 bits) blocks.

A determination unit 310 determines whether the attribute flag data of areceived current pixel and that of a preceding pixel have the samevalue. If the attribute flag data have the same value, that of thecurrent pixel is sent to an RL code generation unit 311. If theattribute flag data have different values, the data is sent to an LTcode generation unit 312. The RL code generation unit 311 counts thenumber of times when the attribute flag data of the current pixel andthat of the preceding pixel have the same value. If the current pixeland preceding pixel have different attribute flag data, or if thecurrent pixel is located at the end of a line in a 32×32 pixel block,the RL code generation unit 311 outputs the code word of the countvalue. The LT code generation unit 312 counts the number of times whenthe attribute flag data of the current pixel and that of the precedingpixel have different values and outputs a code word corresponding to thecount value and attribute flag data equal in number to the count. Acomposition unit 313 composites data output from the RL code generationunit 311 and data output from the LT code generation unit 312 andoutputs the composited data as a code 315. That is, the attribute flagencoding unit 102 of this embodiment uses a Packbits encoding technique.

The arrangement and operation of the image decoding unit 107 aredesigned to reconstruct data by an operation reverse to the attributeflag encoding unit 102.

Attribute flag data is encoded using the above-described losslessencoding method. An implementation method to increase the encodingefficiency will be described below.

In this embodiment, the attribute flag data of one pixel has a size of 1byte (8 bits). The bits are assigned flags shown in FIG. 7. Bits 0 to 7are assigned information representing the presence/absence of pertinentattributes of a pixel. Bits 7 and 6 are undefined and have a fixed valueof “0”.

The process procedure of the attribute flag encoding unit 102 accordingto the embodiment will be described with reference to the flowchart inFIG. 6.

The first phase will be described. In this phase, the rearrangement unit309 reads out each (e.g., 8-bit attribute flag data representing onepixel) of the attribute flag data of 32×32 pixels from the buffer memory101 and directly output the data to the determination unit 310 (stepS601). In step S602, lossless encoding is executed. The encoding resultis stored in the buffer memory 104. This process is repeated until it isdetermined in step S603 that the attribute flag data of one tile isencoded (32×32=1024 times). The encoding process in step S602 is thesame as that explained with reference to FIG. 5. FIG. 8 shows anexample.

Referring to FIG. 8, attribute flag data of 32×32 pixels are numbered inthe scan order and called pixel #1, pixel #2, . . . , pixel #1024. Note,“P #n” (n=1, 2, . . . ) in FIG. 8 denotes pixel #n.

The attribute flag data value of pixel #1 is 38 (26 in hexadecimalnotation), and that of pixel #2 is 37. Four pixels #2 to #5 continuouslyhave the same value four times. The compression ratio is high in thissection. The process of the first phase has been described above.

The second phase from step S604 will be explained next. The attributedata encoding order in the second phase is different from that in thefirst phase.

In step S604, an initial value “7” is set in a variable i. Eightattribute flag data are read out from the buffer memory 104 (step S605).In step S606, bits i (bits 7 in the initial value) of the eightattribute flag data are bundled up to generate 8-bit (1-byte) data. Thedata is output to the determination unit 310, which encodes the data.This process is executed by the rearrangement unit 309.

In step S607, it is determined whether the data of bits i of allattribute flag data of one tile are output. If NO in step S607, theprocess returns to step S605 to read out the next eight attribute flagdata. This process is repeated until it is determined that the data ofbits i of attribute flag data in one tile are output. That is, a bitplane data represented by the variable i is generated from 32×32attribute data. Every 8-bit data is extracted from the bit plane dataand encoded.

When output (encoding) of bits i is ended, the process advances to stepS608 to decrement the variable i by “1”. In step S609, it is determinedwhether the variable i has a negative value. If i≧0, output/encoding ofall bits of all attribute flag data in one tile has not finished yet,the process returns to step S605 to repeat the above-described process.

FIG. 9 shows attribute flag data input to the rearrangement unit 309 inthe second phase and rearranged data.

First, 1-byte data including bits 7 of the attribute flag data of pixels#1 to #8 is output. Next, 1-byte data including bits 7 of pixels #9 to#16 is output. Finally, 1-byte data including bits 7 of pixels #1016 to#1024 is output. Then, the same process is done for the data of bits 6,and ultimately, 1-byte data including bits 0 of pixels #1016 to #1024 isoutput. The process in the second phase has been described above.

When the process in the first and second phases finishes, the buffermemory 104 stores lossless-encoded data generated in the first andsecond phases. In step S610, data with a smaller amount is output to theHDD 105 as the final encoding result of attribute flag data. At thistime, the header at the start of the selected encoded data of attributeflag data stores identification information indicating the selectedphase, the first phase or second phase, i.e., information representingwhether rearrangement has been done. In this embodiment, theidentification information can have a size of 1 bit because it need onlyclarify one of the two phases. If the two encoded data are the same, theencoded data obtained in the first phase is selected. This is becausethe process of restoring the initial state in decoding is unnecessary,and the process speed can increase.

The image encoding unit 103 of this embodiment uses JPEG encoding. Sincemany multiplication processes for DCT and many division processes forquantization are necessary, encoding of one tile requires a long time.On the other hand, the attribute flag encoding unit 102 of thisembodiment executes the encoding process twice most of which are simpleprocesses of, e.g., comparing the current pixel and the preceding pixeland counting the number of times when they have the same value. Hence,the time until the attribute flag encoding unit 102 determines the finalencoded data can be much shorter than the time necessary for the imageencoding unit 103 although the processes of two phases are executed.Even when the attribute flag encoding unit 102 executes encoding in twophases, the image data encoding process never slows down. Even if thespeed decreases, the delay is negligible.

In the decoding process of the attribute flag decoding unit 126, first,lossless-encoded (in this embodiment, run-length-encoded) data of onetile is received and run-length-decoded. If the header storesinformation representing that the lossless-encoded data is generated inthe first phase, i.e., without rearrangement, the data is directlyoutput. If the header stores information indicating the second phase(information indicating rearrangement), the first 1-byte data includesthe data of bits 7 of the attribute flag data of pixels #1 to #8, andthe second 1-byte data includes the data of bits 7 of the attribute flagdata of pixels #9 to #16, as shown in FIG. 10. Hence, the bit data arerearranged. After this process, the attribute flag data are output inthe initial order of pixel #1, pixel #2, . . . .

As described above, according to the embodiment, since encoding isexecuted in the attribute data encoding order in the second phase, it ispossible to encode data using the fact that the probability that theattribute flag data of adjacent pixels have the same bit position ishigher than the probability that the attribute flag data of adjacentpixels have the same value. As a result, the compression ratio can behigher than in simple encoding.

According to the embodiment, two kinds of encoded data are generated foreach attribute flag data. Encoded data with a smaller amount is selectedand output. This implements encoding at a high compression ratio. Theencoding algorithm does not change. To implement the process byhardware, it is only necessary to add the rearrangement unit 309. Hence,the problem of the increase in cost caused by the addition of thecircuit will not be so serious.

In the embodiment, if bit data are rearranged, attribute flag data areoutput in an order from the plane of bit 7 to a lower bit. However, theorder may be reverse.

In the embodiment, attribute flag data encoding is executed twice. Datainput to the lossless encoding unit is assumed to have a size of 8 bits.However, if the significant bits of attribute flag data are less than 8bits, and the remaining bits are handled as reserved bits (dummy dataare added), rearranged encoded data may be employed from the beginning.Especially when bits 7 and 6 of attribute flag data are handled asreserved bits, as shown in FIG. 7, bit planes of the reserved bits havethe same value. This enables to earn runs and guarantees a highcompression ratio from the start. Hence, if attribute flag data has thestructure shown in FIG. 7, lower bits from bit 5 are encoded. In thiscase, “5” is substituted into the variable i in step S604 in FIG. 6. Indecoding, lower bits from bit 5 are decoded, and “0” is stored in bits 6and 7 of data to be output.

In the embodiment, the attribute flag encoding unit 102 and imageencoding unit 103 encode tiles having the same size as a unit. However,the tile size of the encoding unit of the attribute flag encoding unit102 may be different from that of the image encoding unit 103.

The encoding unit of the attribute flag encoding unit 102 may be not atile but attribute flag data corresponding to one line containing pixelsequal in number to the horizontal pixels of an encoding target image. Inthis case, each line is encoded in the first and second phases, and datawith a smaller code amount is selected. Identification data is added tothe start, and the selected encoded data is output.

As described above, the control unit 1011 shown in FIG. 2 which has theCPU and the memory storing programs implements the arrangement shown inFIG. 1. Hence, the present invention can also be implemented by acomputer program.

The computer program is normally stored in a computer-readable storagemedium such as a CD-ROM. The computer program becomes executable when itis set in a read device of a computer and copied or installed in thesystem. Such a computer-readable storage medium is also incorporated inthe present invention, as a matter of course.

The above-described attribute flag data encoding is preferably losslessencoding. However, the present invention is not limited to this. Itsobject is almost achieved if encoding is done by a method capable ofminimizing the difference from original data.

While the present invention has been described with reference toexemplary embodiments, it is to be understood that the invention is notlimited to the disclosed exemplary embodiments. The scope of thefollowing claims is to be accorded the broadest interpretation so as toencompass all such modifications and equivalent structures andfunctions.

This application claims the benefit of Japanese Patent Application No.2006-216256, filed Aug. 8, 2006, which is hereby incorporated byreference herein in its entirety.

1. An image processing apparatus for encoding attribute data of eachpixel of image data, which is expressed by L (L>1) bits to indicate ONor OFF state for each of a plurality of attributes, comprising: at leastone processor configured to function as: an input unit adapted to inputM×N attribute data for M×N pixels, where M and N are integer multiple of“L”; an encoding unit adapted to encode data expressed by L bits; afirst encoding control unit adapted to supply the M×N attribute datainput by said input unit to said encoding unit in an input order,thereby causing said encoding unit to execute encoding; a secondencoding control unit adapted to convert the M×N attribute data input bysaid input unit into bit planes of bit 0 to bit L−1, extract L-bit datafrom one converted bit plane, and supply the extracted L-bit data tosaid encoding unit for each bit plane, thereby causing said encodingunit to execute encoding; and an output control unit adapted to comparean amount of encoded data generated by said encoding unit under thecontrol of said first encoding control unit with an amount of encodeddata generated by said encoding unit under the control of said secondencoding control unit, select encoded data with a smaller amount, andoutput the selected encoded data and identification informationrepresenting the selected data.
 2. The apparatus according to claim 1,wherein said encoding unit executes run-length encoding.
 3. Theapparatus according to claim 1, wherein said encoding unit executesPackbits encoding.
 4. The apparatus according to claim 1, furthercomprising an image encoding unit adapted to lossy-encode, as a unit, animage containing M×N pixels from multi-valued image data as a base ofthe attribute data.
 5. A control method of an image processing apparatusfor encoding attribute data of each pixel of image data, which isexpressed by L (L>1) bits to indicate ON or OFF state for each of aplurality of attributes, comprising: the input step of inputting M×Nattribute data for M×N pixels, where M and N are integer multiple of“L”; the encoding step of encoding data expressed by L bits; the firstencoding control step of supplying the M×N attribute data input in theinput step by the encoding step in an input order, thereby causing theencoding step to execute encoding; the second encoding control step ofconverting the M×N attribute data input in the input step into bitplanes of bit 0 to bit L−1, extracting L-bit data from one converted bitplane, and supplying the extracted L-bit data to the encoding step foreach bit plane, thereby causing the encoding step to execute encoding;and the output control step of comparing an amount of encoded datagenerated in the encoding step under the control of the first encodingcontrol step with an amount of encoded data generated in the encodingstep under the control of the second encoding control step, selectingencoded data with a smaller amount, and outputting the selected encodeddata and identification information representing the selected data.
 6. Anon-transitory computer-readable storage medium which is stored in acomputer-readable storage medium and read out and executed by a computerto execute a method of claim 5.